<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f"%>
<%@ taglib uri="/WEB-INF/tld/tag.tld" prefix="my"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<title>财务总汇</title>
<link rel="stylesheet" type="text/css"
	href="/three/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css"
	href="/three/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css"
	href="/three/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css"
	href="/three/static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css"
	href="/three/static/h-ui.admin/css/style.css" />
<script type="text/javascript"
	src="/three/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/three/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/three/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript"
	src="/three/static/h-ui.admin/js/H-ui.admin.js"></script>
<script type="text/javascript"
	src="/three/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript"
	src="/three/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/three/lib/laypage/1.2/laypage.js"></script>
</head>
<body>
	<script language="JavaScript" type="text/javascript">
		var idTmr;
		function getExplorer() {
			var explorer = window.navigator.userAgent;
			//ie  
			if (explorer.indexOf("MSIE") >= 0) {
				return 'ie';
			}
			//firefox  
			else if (explorer.indexOf("Firefox") >= 0) {
				return 'Firefox';
			}
			//Chrome  
			else if (explorer.indexOf("Chrome") >= 0) {
				return 'Chrome';
			}
			//Opera  
			else if (explorer.indexOf("Opera") >= 0) {
				return 'Opera';
			}
			//Safari  
			else if (explorer.indexOf("Safari") >= 0) {
				return 'Safari';
			}
		}
		function method5(tableid) {
			if (getExplorer() == 'ie') {
				var curTbl = document.getElementById(tableid);
				var oXL = new ActiveXObject("Excel.Application");
				var oWB = oXL.Workbooks.Add();
				var xlsheet = oWB.Worksheets(1);
				var sel = document.body.createTextRange();
				sel.moveToElementText(curTbl);
				sel.select();
				sel.execCommand("Copy");
				xlsheet.Paste();
				oXL.Visible = true;

				try {
					var fname = oXL.Application.GetSaveAsFilename("Excel.xls",
							"Excel Spreadsheets (*.xls), *.xls");
				} catch (e) {
					print("Nested catch caught " + e);
				} finally {
					oWB.SaveAs(fname);
					oWB.Close(savechanges = false);
					oXL.Quit();
					oXL = null;
					idTmr = window.setInterval("Cleanup();", 1);
				}

			} else {
				tableToExcel(tableid)
			}
		}
		function Cleanup() {
			window.clearInterval(idTmr);
			CollectGarbage();
		}
		var tableToExcel = (function() {
			var uri = 'data:application/vnd.ms-excel;base64,', template = '<html><head><meta charset="UTF-8"></head><body><table>{table}</table></body></html>', base64 = function(
					s) {
				return window.btoa(unescape(encodeURIComponent(s)))
			}, format = function(s, c) {
				return s.replace(/{(\w+)}/g, function(m, p) {
					return c[p];
				})
			}
			return function(table, name) {
				if (!table.nodeType)
					table = document.getElementById(table)
				var ctx = {
					worksheet : name || 'Worksheet',
					table : table.innerHTML
				}
				window.location.href = uri + base64(format(template, ctx))
			}
		})()
	</script>
	<form action="" method="post">
		<div class="page-container">
			<div>
				<font size="2">目标现金收入：</font><span id="a">1000</span>
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<font size="2">目标消耗收入：</font><span id="b">1000</span> <br> <font
					size="2">现金收入：</font><span id="c">${cashIncome }</span>
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<font size="2">消耗收入：</font><span id="d">${extendIncome }</span> <br>
				<font size="2">现金收入完成率：</font><span id="e" style="color: red"></span>
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<font size="2">消耗收入完成率：</font><span id="f" style="color: red"></span>
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				统计月份:<input type="month" id="logmin" class="input-text Wdate"
					style="width: 150px;" name="qpayTime">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<button type="submit" class="btn btn-success" value="查询">
					<i class="Hui-iconfont">&#xe665;</i> 查询
				</button>
				<br>
			</div>
			<button type="button" class="btn btn-success" value="导出Excel"
				onclick="method5('tableExcel')">
				<i class="Hui-iconfont">&#xe665;</i>导出Excel
			</button>
			<div class="mt-20">
				<table
					class="table table-border table-bordered table-hover table-bg table-sort"
					id="tableExcel">
					<thead>
						<tr class="text-c">
							<td width="80">订单编号</td>
							<td>交易时间</td>
							<td>顾客账号</td>
							<td>顾客姓名</td>
							<td>交易内容</td>
							<td>价格(元)</td>
							<td>实付金额(元)</td>
							<td>消耗颜值</td>
							<td>支付方式</td>
							<td>现金收入（元）</td>
							<td>消耗收入（元）</td>
							<td>服务员工</td>
							<td>经手员工</td>

						</tr>
					</thead>
					<tbody>
						<c:forEach items="${list}" var="bus">
							<tr class="text-c">
								<td>${bus.orderId }</td>
								<td><f:formatDate value="${bus.payTime}"
										pattern="yyyy-MM-dd" /></td>
								<td>${bus.bisCustomUser.customUserId}</td>
								<td>${bus.bisCustomUser.username}</td>
								<td>${bus.orderContent}</td>
								<td>
									<c:if test="${bus.orderMoney==null}">0</c:if>
									<c:if test="${bus.orderMoney!=null}">${bus.orderMoney}</c:if>
								</td>
								<td>
									<c:if test="${bus.payMoney==null}">0</c:if>
									<c:if test="${bus.payMoney!=null}">${bus.payMoney}</c:if>
								</td>
								<td>${bus.extendBeautyNum}</td>
								<td><c:if test="${bus.payWay=='1'}">
					  微信
					 </c:if> <c:if test="${bus.payWay=='2'}">
					  支付宝
					 </c:if> <c:if test="${bus.payWay=='3'}">
					  美颜币
					 </c:if> <c:if test="${bus.payWay=='4'}">
					  套餐
					 </c:if></td>
								<td>
									<c:if test="${bus.cashIncome==null}">0</c:if>
									<c:if test="${bus.cashIncome!=null}">${bus.cashIncome}</c:if>
								</td>
								<td>
									<c:if test="${bus.extendIncome==null}">0</c:if>
								<c:if test="${bus.extendIncome!=null}">${bus.extendIncome}</c:if>
								</td>
								<td>${bus.bisShopUser.username}</td>
								<td>${bus.bisShopUser.username}</td>
							</tr>
						</c:forEach>
					</tbody>
				</table>
			</div>
		</div>
	</form>
</body>
<script type="text/javascript">
	$('.table-sort').dataTable({
		"aaSorting" : [ [ 1, "desc" ] ],//默认第几个排序
		"bStateSave" : true,//状态保存
		"pading" : false,
	/* "aoColumnDefs": [
	  {"orderable":false,"aTargets":[0,8]}// 不参与排序的列
	] */
	});
	var a = $("#a").html();
	var b = $("#b").html();
	var c = $("#c").html();
	var d = $("#d").html();
	$("#e").html(c / a * 100 + '%');
	$("#f").html(d / b * 100 + '%');
</script>
</html>